Hi All ,
I am using events v1 API for acknowledge incident based on the key.
Steps Followed ;
Create service and integrated with events v1 API (integration key )
created incodent from frontend and get the incident key
Calls below python code with two inputs .
#!/usr/bin/env python
import json
import requests
SERVICE_KEY = “***” # ENTER EVENTS V1 API INTEGRATION KEY HERE
INCIDENT_KEY = “dddf7f1af56740ed9b4c2e6664ad6038” # ENTER INCIDENT KEY
def ack_incident():
# Triggers a PagerDuty incident without a previously generated incident key
# Uses Events V1 API - documentation: https://v2.developer.pagerduty.com/docs/trigger-events
payload = { # Payload is built with the least amount of fields required to trigger an incident
"service_key": SERVICE_KEY,
"event_type": "acknowledge",
"incident_key": INCIDENT_KEY,
"description": "Example alert on host1.example.com",
#"contexts": "https://app.pagerduty.com"
}
response = requests.post('https://events.pagerduty.com/generic/2010-04-15/create_event.json',
data=json.dumps(payload))
if response.json()["status"] == "success":
print response.text
print('Incident Acknowledged')
else:
print(response.text) # print error message if not successful
if name == ‘main’:
ack_incident()
Though it is giving success response but the incident is in triggered state rather than acknowledged …>
Can some help me out on this ??